示例#1
0
 def test_create_policy_profile(self):
     _db_profile = n1kv_db_v2.create_policy_profile(TEST_POLICY_PROFILE)
     self.assertIsNotNone(_db_profile)
     db_profile = (self.session.query(n1kv_models_v2.PolicyProfile).
                   filter_by(name=TEST_POLICY_PROFILE['name']).one)()
     self.assertIsNotNone(db_profile)
     self.assertTrue(_db_profile.id == db_profile.id)
     self.assertTrue(_db_profile.name == db_profile.name)
示例#2
0
def _create_test_policy_profile_if_not_there(session,
                                             profile=TEST_POLICY_PROFILE):
    try:
        _profile = session.query(n1kv_models_v2.PolicyProfile).filter_by(
            name=profile['name']).one()
    except s_exc.NoResultFound:
        _profile = n1kv_db_v2.create_policy_profile(profile)
    return _profile
示例#3
0
def _create_test_policy_profile_if_not_there(session,
                                             profile=TEST_POLICY_PROFILE):
    try:
        _profile = session.query(n1kv_models_v2.PolicyProfile).filter_by(
            name=profile['name']).one()
    except s_exc.NoResultFound:
        _profile = n1kv_db_v2.create_policy_profile(profile)
    return _profile
示例#4
0
 def test_create_policy_profile(self):
     _db_profile = n1kv_db_v2.create_policy_profile(TEST_POLICY_PROFILE)
     self.assertIsNotNone(_db_profile)
     db_profile = (self.session.query(n1kv_models_v2.PolicyProfile).
                   filter_by(name=TEST_POLICY_PROFILE['name']).one)()
     self.assertIsNotNone(db_profile)
     self.assertTrue(_db_profile.id == db_profile.id)
     self.assertTrue(_db_profile.name == db_profile.name)
示例#5
0
    def _make_test_policy_profile(self, name='service_profile'):
        """
        Create a policy profile record for testing purpose.

        :param name: string representing the name of the policy profile to
                     create. Default argument value chosen to correspond to the
                     default name specified in config.py file.
        """
        uuid = test_api_v2._uuid()
        profile = {'id': uuid, 'name': name}
        return n1kv_db_v2.create_policy_profile(profile)
示例#6
0
    def _make_test_policy_profile(self, name="service_profile"):
        """
        Create a policy profile record for testing purpose.

        :param name: string representing the name of the policy profile to
                     create. Default argument value chosen to correspond to the
                     default name specified in config.py file.
        """
        uuid = test_api_v2._uuid()
        profile = {"id": uuid, "name": name}
        return n1kv_db_v2.create_policy_profile(profile)
示例#7
0
 def _make_test_policy_profile(self, id):
     """Create a policy profile record for testing purpose."""
     profile = {'id': id,
                'name': 'TestGrizzlyPP'}
     profile_obj = n1kv_db_v2.create_policy_profile(profile)
     return profile_obj