def test_get_all_success(self): json = { 'description': '24/7 support', 'disabled': True, 'name': 'support', 'project_id': '5fccabbb-9d65-417f-8b0b-a2fc77b501e6', 'updated_at': None, 'user_id': '09f07543-6dad-441b-acbf-1c61b5f4015e', } params = { 'description': json['description'], 'disabled': json['disabled'], 'name': json['name'], } headers = { 'X-User-Id': json['user_id'], 'X-Tenant-Id': json['project_id'], } queue = self.post_json( '/queues', params=params, status=200, headers=headers) self.assertTrue(uuidutils.is_uuid_like(queue['uuid'])) json = { 'project_id': '5fccabbb-9d65-417f-8b0b-a2fc77b501e6', 'updated_at': None, 'user_id': '09f07543-6dad-441b-acbf-1c61b5f4015e', } agent = self.post_json( '/agents', params=json, status=200, headers=self.auth_headers) self.assertTrue(uuidutils.is_uuid_like(agent['uuid'])) json = { 'agent_uuid': agent['uuid'], 'queue_uuid': queue['uuid'], 'updated_at': None, } params = { 'agent_uuid': json['agent_uuid'], } tmp = self.post_json( '/queues/%s/members' % queue['uuid'], params=params, status=200, headers=self.auth_headers) self.assertTrue(tmp) res = self.get_json( '/queues/%s/members' % queue['uuid']) for k, v in json.iteritems(): self.assertEqual(res[0][k], v) self.assertTrue(res[0]['created_at']) # NOTE(pabelanger): We add 1 because of created_at self.assertEqual(len(res[0]), len(json) + 1)
def test_success(self): row = { 'description': '24/7 support', 'disabled': True, 'id': 1, 'name': 'support', 'project_id': '793491dd5fa8477eb2d6a820193a183b', 'updated_at': None, 'user_id': '02d99a62af974b26b510c3564ba84644' } tmp = self.db_api.create_queue( name=row['name'], user_id=row['user_id'], project_id=row['project_id'], description=row['description'], disabled=row['disabled']) res = self.db_api.get_queue(uuid=tmp['uuid']) for k, v in row.iteritems(): self.assertEqual(res[k], v) self.assertEqual(type(res['created_at']), datetime.datetime) self.assertTrue(uuidutils.is_uuid_like(res['uuid'])) # NOTE(pabelanger): We add 3 because of created_at, uuid, and hidden # sqlalchemy object. self.assertEqual(len(res.__dict__), len(row) + 3)
def test_get_all_success(self): json = { 'description': '24/7 support', 'disabled': True, 'name': 'support', 'project_id': '5fccabbb-9d65-417f-8b0b-a2fc77b501e6', 'updated_at': None, 'user_id': '09f07543-6dad-441b-acbf-1c61b5f4015e', } params = { 'description': json['description'], 'disabled': json['disabled'], 'name': json['name'], } headers = { 'X-User-Id': json['user_id'], 'X-Tenant-Id': json['project_id'], } tmp = self.post_json('/queues', params=params, status=200, headers=headers) self.assertTrue(tmp) res = self.get_json('/queues') for k, v in json.iteritems(): self.assertEqual(res[0][k], v) self.assertTrue(res[0]['created_at']) self.assertTrue(uuidutils.is_uuid_like(res[0]['uuid'])) # NOTE(pabelanger): We add 2 because of created_at and uuid self.assertEqual(len(res[0]), len(json) + 2)
def test_get_one_success(self): json = { 'description': '24/7 support', 'disabled': True, 'name': 'support', 'project_id': '5fccabbb-9d65-417f-8b0b-a2fc77b501e6', 'updated_at': None, 'user_id': '09f07543-6dad-441b-acbf-1c61b5f4015e', } params = { 'description': json['description'], 'disabled': json['disabled'], 'name': json['name'], } headers = { 'X-User-Id': json['user_id'], 'X-Tenant-Id': json['project_id'], } tmp = self.post_json( '/queues', params=params, status=200, headers=headers) self.assertTrue(tmp) res = self.get_json('/queues/%s' % tmp['uuid']) for k, v in json.iteritems(): self.assertEqual(res[k], v) self.assertTrue(res['created_at']) self.assertTrue(uuidutils.is_uuid_like(res['uuid'])) # NOTE(pabelanger): We add 2 because of created_at and uuid self.assertEqual(len(res), len(json) + 2)
def test_success(self): row = { 'description': '24/7 support', 'disabled': True, 'id': 1, 'name': 'support', 'project_id': '793491dd5fa8477eb2d6a820193a183b', 'updated_at': None, 'user_id': '02d99a62af974b26b510c3564ba84644' } self.db_api.create_queue( name=row['name'], user_id=row['user_id'], project_id=row['project_id'], description=row['description'], disabled=row['disabled']) res = self.db_api.list_queues() self.assertEqual(len(res), 1) for k, v in row.iteritems(): self.assertEqual(res[0][k], v) self.assertEqual(type(res[0]['created_at']), datetime.datetime) self.assertTrue(uuidutils.is_uuid_like(res[0]['uuid'])) # NOTE(pabelanger): We add 3 because of created_at, uuid, and hidden # sqlalchemy object. self.assertEqual(len(res[0].__dict__), len(row) + 3)
def test_required_fields(self): row = { 'id': 1, 'project_id': '793491dd5fa8477eb2d6a820193a183b', 'updated_at': None, 'user_id': '02d99a62af974b26b510c3564ba84644' } res = self.db_api.create_agent( user_id=row['user_id'], project_id=row['project_id']) for k, v in row.iteritems(): self.assertEqual(res[k], v) self.assertEqual(type(res['created_at']), datetime.datetime) self.assertTrue(uuidutils.is_uuid_like(res['uuid']))
def test_required_fields(self): row = { 'description': '', 'disabled': False, 'id': 1, 'name': 'support', 'project_id': '793491dd5fa8477eb2d6a820193a183b', 'updated_at': None, 'user_id': '02d99a62af974b26b510c3564ba84644' } res = self.db_api.create_queue(name=row['name'], user_id=row['user_id'], project_id=row['project_id']) for k, v in row.iteritems(): self.assertEqual(res[k], v) self.assertEqual(type(res['created_at']), datetime.datetime) self.assertTrue(uuidutils.is_uuid_like(res['uuid']))
def test_all_fields(self): row = { 'id': 1, 'project_id': '793491dd5fa8477eb2d6a820193a183b', 'updated_at': None, 'user_id': '02d99a62af974b26b510c3564ba84644' } res = self.db_api.create_agent( user_id=row['user_id'], project_id=row['project_id']) for k, v in row.iteritems(): self.assertEqual(res[k], v) self.assertEqual(type(res['created_at']), datetime.datetime) self.assertTrue(uuidutils.is_uuid_like(res['uuid'])) # NOTE(pabelanger): We add 3 because of created_at, uuid, and hidden # sqlalchemy object. self.assertEqual(len(res.__dict__), len(row) + 3)
def test_required_fields(self): row = { 'description': '', 'disabled': False, 'id': 1, 'name': 'support', 'project_id': '793491dd5fa8477eb2d6a820193a183b', 'updated_at': None, 'user_id': '02d99a62af974b26b510c3564ba84644' } res = self.db_api.create_queue( name=row['name'], user_id=row['user_id'], project_id=row['project_id']) for k, v in row.iteritems(): self.assertEqual(res[k], v) self.assertEqual(type(res['created_at']), datetime.datetime) self.assertTrue(uuidutils.is_uuid_like(res['uuid']))
def test_all_fields(self): json = { 'project_id': '5fccabbb-9d65-417f-8b0b-a2fc77b501e6', 'updated_at': None, 'user_id': '09f07543-6dad-441b-acbf-1c61b5f4015e', } res = self.post_json('/agents', params=json, status=200, headers=self.auth_headers) for k, v in json.iteritems(): self.assertEqual(res[k], v) self.assertTrue(res['created_at']) self.assertTrue(uuidutils.is_uuid_like(res['uuid'])) # NOTE(pabelanger): We add 2 because of created_at and uuid self.assertEqual(len(res), len(json) + 2)