def test_basic(self): sot = zone.Zone() self.assertEqual('/zones', sot.base_path) self.assertEqual('zones', sot.resources_key) self.assertIsNone(sot.resource_key) self.assertTrue(sot.allow_list) self.assertTrue(sot.allow_fetch) self.assertTrue(sot.allow_create) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_commit)
def test_disassociate_router(self): sot = zone.Zone(**EXAMPLE) mock_response = mock.Mock() mock_response.status_code = 200 mock_response.headers = {} mock_response.json.return_value = {} self.sess.post.return_value = mock_response sot.disassociate_router(self.sess, router_id=1) self.sess.post.assert_called_once_with( 'zones/%s/disassociaterouter' % FAKE_ID, json={'router': { 'router_id': 1 }})
def test_make_it(self): sot = zone.Zone(**EXAMPLE) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['email'], sot.email) self.assertEqual(EXAMPLE['ttl'], sot.ttl) self.assertEqual(EXAMPLE['serial'], sot.serial) self.assertEqual(EXAMPLE['masters'], sot.masters) self.assertEqual(EXAMPLE['status'], sot.status) self.assertEqual(EXAMPLE['pool_id'], sot.pool_id) self.assertEqual(EXAMPLE['project_id'], sot.project_id) self.assertEqual(EXAMPLE['zone_type'], sot.zone_type) self.assertEqual(EXAMPLE['created_at'], sot.created_at) self.assertEqual(EXAMPLE['updated_at'], sot.updated_at) self.assertEqual(EXAMPLE['record_num'], sot.record_num) self.assertEqual(len(EXAMPLE['routers']), len(sot.routers))