Refactor for OSC network unit tests.

Registered by Tang Chen

Currently, there are lots of redundant code in network unit tests. And the class architecture is different from all the other test classes. So network unit test needs a refactor before we go further to implement network commands.

The refactor will go as below:

1. Using the same class inherit architecture as the other test classes.
utils.TestCommand -> TestNetworkV2 -> TestNetwork -> TestXXXNetwork

2. Initialize common Mocks in setUp() to reduce redundant code.

3. Introduce class FakeNetwork to fake one or more networks, just like FakeServer.

This BP is connected to BP [1]. If we don't refactor the unit tests of network, the implementation of network commands won't go well.

[1] https://blueprints.launchpad.net/python-openstackclient/+spec/neutron-client

Blueprint information

Status:
Complete
Approver:
Tang Chen
Priority:
Medium
Drafter:
Tang Chen
Direction:
Approved
Assignee:
Tang Chen
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Richard Theis
Completed by
Richard Theis

Related branches

Sprints

Whiteboard

(rtheis): Hi Tang, is this blueprint completed?

(tangchen): Yes, this is completed. Thanks for reminding me, Richard.:)

Gerrit topic: https://review.openstack.org/#q,topic:bp/osc-network-unit-test-refactor,n,z

Addressed by: https://review.openstack.org/251359
    Refactor network test: Introduce TestNetworkv2 and TestNetwork to improve unit test of network.

Addressed by: https://review.openstack.org/251360
    Refactor TestCreateNetwork: Split TestCreateNetwork into two classes for identity v2 and v3.

Addressed by: https://review.openstack.org/251361
    Refactor TestCreateNetwork: Setup cmd in setUp() in TestCreateNetworkIdentityV3.

Addressed by: https://review.openstack.org/251362
    Refactor TestCreateNetwork: Setup cmd in setUp() in TestCreateNetworkIdentityV2.

Addressed by: https://review.openstack.org/251363
    Refactor TestCreateNetwork: Setup identity client in setUp() in TestCreateNetworkIdentityV3.

Addressed by: https://review.openstack.org/251364
    Refactor TestCreateNetwork: Setup identity client in setUp() in TestCreateNetworkIdentityV2.

Addressed by: https://review.openstack.org/251365
    Refactor TestDeleteNetwork: Use TestNetwork in TestDeleteNetwork.

Addressed by: https://review.openstack.org/251618
    Refactor TestListNetwork: Use TestNetwork in TestListNetwork

Addressed by: https://review.openstack.org/251619
    Refactor TestSetNetwork: Use TestNetwork in TestSetNetwork

Addressed by: https://review.openstack.org/251620
    Refactor TestShowNetwork: Use TestNetwork in TestShowNetwork

Addressed by: https://review.openstack.org/251621
    Refactor network test: Remove unusful test code.

Addressed by: https://review.openstack.org/138745
    SDK integration: Add a temporary method to create network client using sdk.

Addressed by: https://review.openstack.org/253342
    Introduce class FakeNetwork to fake one or more networks.

Addressed by: https://review.openstack.org/253343
    Migrate "network list" command to new version using SDK.

Addressed by: https://review.openstack.org/253344
    Migrate "network create" command to use SDK.

Addressed by: https://review.openstack.org/253345
    Migrate "network delete" command to use SDK.

Addressed by: https://review.openstack.org/253346
    Migrate "network set" command to use SDK.

Addressed by: https://review.openstack.org/253347
    Migrate "network show" command to use SDK.

Addressed by: https://review.openstack.org/253348
    Migrate network client to SDK.

Addressed by: https://review.openstack.org/253349
    Remove unuseful test data in test_netwrok.py

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.