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_to_dict_only_id(self): p = Profile(id_=FAKE_DATA["id_"]) with self.assertRaises(AttributeError): p.to_dict()
def test_to_dict_only_name(self): p = Profile(name=FAKE_DATA["username"]) with self.assertRaises(AttributeError): p.to_dict()
def test_to_dict_no_data(self): p = Profile() with self.assertRaises(AttributeError): p.to_dict()