def setUp(self): u = get_user_model()() u.id = 1 u.username = '******' u.first_name = 'test' u.last_name = 'test' u.email = 'test' u.set_password('test') u.save() p = Provider() p.id = 1 p.user = u p.name = "test" p.email = "*****@*****.**" p.phone = 12312312 p.currency = "USD" p.language = "DE" p.save() a = Area() a.id = 1 a.name = "test" a.price = 10.20 a.provider = p a.poly = '{ "type": "Polygon", "coordinates": [ [ [0, 0], [10, 50], [10, 0], [0, 0] ] ] }' a.save() u = get_user_model()() u.id = 2 u.username = '******' u.first_name = 'test2' u.last_name = 'test2' u.email = '*****@*****.**' u.set_password('test') u.save() p = Provider() p.id = 2 p.user = u p.name = "test2" p.email = "*****@*****.**" p.phone = 123123212 p.currency = "USD" p.language = "EN" p.save() a = Area() a.id = 2 a.name = "test2" a.price = 10.20 a.provider = p a.poly = '{ "type": "Polygon", "coordinates": [ [ [0, 0], [10, 50], [10, 0], [0, 0] ] ] }' a.save() self.url = reverse("area:area-detail",kwargs={"pk":1})
def create_provider(firstname, lastname, job_title, affiliation): firstclean = firstname.replace("'","") lastclean = lastname.replace("'","") prov = Provider() prov.job_title = job_title prov.affiliation = affiliation prov.user = create_user(username=firstclean.lower() + "_" + lastclean.lower(), password='******', firstname=firstname, lastname = lastname) prov.save() transaction.commit() return prov
def setUp(self): u = get_user_model()() u.id = 1 u.username = '******' u.first_name = 'test' u.last_name = 'test' u.email = '*****@*****.**' u.set_password('test') u.save() p = Provider() p.id = 1 p.user = u p.name = "test" p.email = "*****@*****.**" p.phone = 12312312 p.currency = "USD" p.language = "DE" p.save() u = get_user_model()() u.id = 2 u.username = '******' u.first_name = 'test2' u.last_name = 'test2' u.email = '*****@*****.**' u.set_password('test') u.save() p = Provider() p.id = 2 p.user = u p.name = "test2" p.email = "*****@*****.**" p.phone = 123123212 p.currency = "USD" p.language = "EN" p.save() self.url = reverse("area:area-list")