Пример #1
0
 def test_equality(self):
     obj1 = BaseEndPoint(name="Angus")
     obj2 = BaseEndPoint(name="Malcolm")
     self.assertEqual(obj1, obj2)
     obj1.id = 1
     obj2.id = 2
     self.assertNotEqual(obj1, obj2)
Пример #2
0
 def test_equality(self):
     obj1 = BaseEndPoint(name="Angus")
     obj2 = BaseEndPoint(name="Malcolm")
     self.assertEqual(obj1, obj2)
     obj1.id = 1
     obj2.id = 2
     self.assertNotEqual(obj1, obj2)
Пример #3
0
 def test_cls_get_url_with_no_id(self):
     url = BaseEndPoint.get_url()
     self.assertEqual(url, 'https://example.com/api/v2/an-endpoint')
Пример #4
0
 def test_get_url_with_id(self):
     obj = BaseEndPoint(id=1)
     self.assertEqual(obj.get_url(), 'https://example.com/api/v2/an-endpoint/1')
Пример #5
0
 def test__repr_id(self):
     obj = BaseEndPoint(id=1)
     self.assertEqual(obj.__repr__(), '<BaseEndPoint 1>')
Пример #6
0
 def test__repr_no_id(self):
     obj = BaseEndPoint()
     self.assertEqual(obj.__repr__(), '<BaseEndPoint >')
Пример #7
0
 def test_equality_true(self):
     obj1 = BaseEndPoint(name="Angus")
     obj2 = BaseEndPoint(name="Angus")
     self.assertEqual(obj1, obj2)
Пример #8
0
    def test_get_id(self):
        obj = BaseEndPoint(id=1)
        self.assertEqual(obj.id, 1)

        self.assertEqual(obj.get_id(), 1)
Пример #9
0
 def test__as_dict(self):
     obj = BaseEndPoint(id=1, name='foo')
     six.assertCountEqual(self,
                          obj.as_dict().items(), [('id', 1),
                                                  ('name', 'foo')])
Пример #10
0
    def test__get_public_attrs(self):
        obj = BaseEndPoint(id=1, name='foo')
        six.assertCountEqual(self, obj._get_public_attrs(), ['id', 'name'])

        obj = BaseEndPoint()
        six.assertCountEqual(self, obj._get_public_attrs(), [])
Пример #11
0
 def test_cls_get_url_with_no_id(self):
     url = BaseEndPoint.get_url()
     self.assertEqual(url, 'https://example.com/api/v2/an-endpoint')
Пример #12
0
 def test_get_url_with_id(self):
     obj = BaseEndPoint(id=1)
     self.assertEqual(obj.get_url(),
                      'https://example.com/api/v2/an-endpoint/1')
Пример #13
0
 def test__repr_id(self):
     obj = BaseEndPoint(id=1)
     self.assertEqual(obj.__repr__(), '<BaseEndPoint 1>')
Пример #14
0
 def test__repr_no_id(self):
     obj = BaseEndPoint()
     self.assertEqual(obj.__repr__(), '<BaseEndPoint >')
Пример #15
0
    def test__get_public_attrs(self):
        obj = BaseEndPoint(id=1, name='foo')
        six.assertCountEqual(self, obj._get_public_attrs(), ['id', 'name'])

        obj = BaseEndPoint()
        six.assertCountEqual(self, obj._get_public_attrs(), [])
Пример #16
0
 def test__as_dict(self):
     obj = BaseEndPoint(id=1, name='foo')
     six.assertCountEqual(self, obj.as_dict().items(), [('id', 1), ('name', 'foo')])
Пример #17
0
    def test_get_id(self):
        obj = BaseEndPoint(id=1)
        self.assertEqual(obj.id, 1)

        self.assertEqual(obj.get_id(), 1)
Пример #18
0
 def test_get_changed1(self):
     obj = BaseEndPoint(id=1)
     self.assertEqual(obj.get_changed(), {'id': 1})
Пример #19
0
 def test_get_changed1(self):
     obj = BaseEndPoint(id=1)
     self.assertEqual(obj.get_changed(), {'id': 1})