def test_init_positional(self):
     p = Profile(FAKE_DATA["id_"], FAKE_DATA["username"])
     self.assertEqual(p.id_, FAKE_DATA["id_"])
     self.assertEqual(p.name, FAKE_DATA["username"])
 def test_init_id(self):
     p = Profile(id_=FAKE_DATA["id_"])
     self.assertEqual(p.id_, FAKE_DATA["id_"])
 def test_init_name(self):
     p = Profile(name=FAKE_DATA["username"])
     self.assertEqual(p.name, FAKE_DATA["username"])
 def test_bool_with_data(self):
     p = Profile(FAKE_DATA["id_"], FAKE_DATA["username"])
     self.assertTrue(p)
     self.assertTrue(p.__bool__())
     self.assertTrue(p.__nonzero__())
 def test_init_no_values(self):
     p = Profile()
     self.assertIs(p.id_, None)
     self.assertIs(p.name, None)
 def test_to_dict_only_name(self):
     p = Profile(name=FAKE_DATA["username"])
     with self.assertRaises(AttributeError):
         p.to_dict()
Beispiel #7
0
 def test_bool_only_id(self):
     p = Profile(id_=FAKE_DATA["id_"])
     self.assertFalse(p)
     self.assertFalse(p.__bool__())
     self.assertFalse(p.__nonzero__())
Beispiel #8
0
    def test_to_dict(self):
        p = Profile(FAKE_DATA["id_"], FAKE_DATA["username"])
        d = p.to_dict()

        self.assertEqual(FAKE_DATA["id_"], d["id"])
        self.assertEqual(FAKE_DATA["username"], d["name"])
 def test_bool_no_data(self):
     p = Profile()
     self.assertFalse(p)
     self.assertFalse(p.__bool__())
     self.assertFalse(p.__nonzero__())
Beispiel #10
0
 def test_to_dict_only_id(self):
     p = Profile(id_=FAKE_DATA["id_"])
     with self.assertRaises(AttributeError):
         p.to_dict()
Beispiel #11
0
 def test_to_dict_only_name(self):
     p = Profile(name=FAKE_DATA["username"])
     with self.assertRaises(AttributeError):
         p.to_dict()
Beispiel #12
0
 def test_to_dict_no_data(self):
     p = Profile()
     with self.assertRaises(AttributeError):
         p.to_dict()
Beispiel #13
0
 def test_bool_with_data(self):
     p = Profile(FAKE_DATA["id_"], FAKE_DATA["username"])
     self.assertTrue(p)
     self.assertTrue(p.__bool__())
     self.assertTrue(p.__nonzero__())
Beispiel #14
0
 def test_bool_only_name(self):
     p = Profile(name=FAKE_DATA["username"])
     self.assertFalse(p)
     self.assertFalse(p.__bool__())
     self.assertFalse(p.__nonzero__())
 def test_to_dict_no_data(self):
     p = Profile()
     with self.assertRaises(AttributeError):
         p.to_dict()
 def test_bool_only_id(self):
     p = Profile(id_=FAKE_DATA["id_"])
     self.assertFalse(p)
     self.assertFalse(p.__bool__())
     self.assertFalse(p.__nonzero__())
 def test_to_dict_only_id(self):
     p = Profile(id_=FAKE_DATA["id_"])
     with self.assertRaises(AttributeError):
         p.to_dict()
 def test_bool_only_name(self):
     p = Profile(name=FAKE_DATA["username"])
     self.assertFalse(p)
     self.assertFalse(p.__bool__())
     self.assertFalse(p.__nonzero__())
    def test_to_dict(self):
        p = Profile(FAKE_DATA["id_"], FAKE_DATA["username"])
        d = p.to_dict()

        self.assertEqual(FAKE_DATA["id_"], d["id"])
        self.assertEqual(FAKE_DATA["username"], d["name"])
Beispiel #20
0
 def test_bool_no_data(self):
     p = Profile()
     self.assertFalse(p)
     self.assertFalse(p.__bool__())
     self.assertFalse(p.__nonzero__())