def setUp(self) -> None: """Setup for test case""" self.factory = RequestFactory() test_utils.setup() self.user = test_utils.create_dummyuser() self.user2 = test_utils.create_dummyuser(username="******", email="*****@*****.**") self.fridge = test_utils.create_dummyfridge() test_utils.connect_fridge_user() test_utils.create_login_token(timezone.now() + timezone.timedelta(days=1), username=self.user.username) test_utils.create_api_token(timezone.now() + timezone.timedelta(days=1), tok="API Token", username=self.user2.username) test_utils.create_api_token(timezone.now() + timezone.timedelta(days=1), tok="Already in Fridge", username=self.user.username) self.token = "jointoken" test_utils.create_join_token(tok=self.token, fridge=self.fridge) self.s_request = self.factory.get( f"/fridge/management/join?token={self.token}") self.s_request.META["HTTP_AUTHORIZATION"] = "API Token"
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.setup() test_utils.create_dummyuser() test_utils.create_items("Item A") test_utils.create_items("Item B") test_utils.create_api_token(timezone.now() + timezone.timedelta(hours=1))
def setUp(self): """Setup for test""" self.factory = RequestFactory() test_utils.setup() test_utils.create_dummyuser() Accesstokens.objects.create( accesstoken="Token", provider=Providers.objects.filter(name="Fridgify").first(), valid_till=timezone.now() + datetime.timedelta(days=14), user=Users.objects.filter(username="******").first())
def setUp(self) -> None: """Setup for test case""" self.user = test_utils.create_dummyuser() self.user_b = test_utils.create_dummyuser(username="******", email="*****@*****.**") self.fridge = test_utils.create_dummyfridge("Fridge A") test_utils.connect_fridge_user(self.user.username, self.fridge.name) test_utils.connect_fridge_user(self.user_b.username, self.fridge.name) test_utils.create_message_token(tok="fridgify_1", username=self.user.username) test_utils.create_message_token(tok="hopper_1", username=self.user.username, provider="Hopper") test_utils.create_message_token(tok="fridgify_2", username=self.user_b.username)
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.setup() test_utils.create_dummyuser() test_utils.create_dummyfridge() test_utils.connect_fridge_user() test_utils.create_login_token(timezone.now() + timezone.timedelta(days=14)) test_utils.create_api_token(timezone.now() + timezone.timedelta(days=14)) test_utils.create_items("Item A") test_utils.create_items("Item B") test_utils.create_fridge_content( test_utils.get_item("Item A").values()[0]["item_id"], test_utils.get_fridge("Dummy Fridge").values()[0]["fridge_id"])
def setUp(self) -> None: """Setup for test case""" self.user = test_utils.create_dummyuser() self.fridge = test_utils.create_dummyfridge("Fridge A") self.fridge_b = test_utils.create_dummyfridge("Fridge B") test_utils.connect_fridge_user(self.user.username, self.fridge.name) test_utils.connect_fridge_user(self.user.username, self.fridge_b.name) self.item_a = test_utils.create_items("Item A") self.item_b = test_utils.create_items("Item B") date = timezone.datetime.now() + timezone.timedelta(days=1) date_future = timezone.datetime.now() + timezone.timedelta(days=10) test_utils.create_fridge_content(self.item_a.item_id, self.fridge.fridge_id, year=date_future.year, month=date_future.month, day=date_future.day) test_utils.create_fridge_content(self.item_b.item_id, self.fridge.fridge_id, year=date.year, month=date.month, day=date.day) test_utils.create_fridge_content(self.item_a.item_id, self.fridge_b.fridge_id, year=date.year, month=date.month, day=date.day)
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.clean() test_utils.setup() user = test_utils.create_dummyuser() Accesstokens.objects.create( user=user, accesstoken="Token", provider=Providers.objects.get(name="Fridgify"), valid_till=timezone.now() + timezone.timedelta(days=1))
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.setup() test_utils.create_dummyuser() test_utils.create_dummyuser("us2", "user", "name", "[email protected]") test_utils.create_dummyfridge() test_utils.connect_fridge_user() test_utils.create_items("Item A") test_utils.create_items("Item B") test_utils.create_login_token( timezone.now() + timezone.timedelta(hours=1) ) test_utils.create_api_token( timezone.now() + timezone.timedelta(hours=1) ) test_utils.create_api_token( timezone.now() + timezone.timedelta(hours=1), username="******", tok="APIToken2" )
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.setup() user = test_utils.create_dummyuser(username="******") test_utils.create_login_token(timezone.now() + timezone.timedelta(days=1), username=user.username) test_utils.create_api_token(timezone.now() + timezone.timedelta(days=1), tok="API Token", username=user.username)
def setUp(self) -> None: """Setup for test case""" self.factory = RequestFactory() test_utils.setup() self.user = test_utils.create_dummyuser() self.fridge = test_utils.create_dummyfridge() test_utils.connect_fridge_user() test_utils.create_login_token( timezone.now() + timezone.timedelta(days=1), username=self.user.username ) test_utils.create_api_token( timezone.now() + timezone.timedelta(days=1), tok="API Token", username=self.user.username ) self.s_request = self.factory.get(f"/fridge/management/{self.fridge.fridge_id}/qr-code") self.s_request.META["HTTP_AUTHORIZATION"] = "API Token"
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.setup() self.user = [] self.user.append(test_utils.create_dummyuser( username="******", name="Test", surname="User", email="*****@*****.**" )) self.user.append(test_utils.create_dummyuser( username="******", name="Test 2", surname="User 2", email="*****@*****.**" )) self.user.append(test_utils.create_dummyuser( username="******", name="Test 3", surname="User 3", email="*****@*****.**" )) self.fridge = test_utils.create_dummyfridge(name="Test Fridge") test_utils.connect_fridge_user( username=self.user[0].username, fridge=self.fridge.name, role=const.Constants.ROLE_OWNER ) test_utils.connect_fridge_user( username=self.user[1].username, fridge=self.fridge.name, role=const.Constants.ROLE_OVERSEER ) test_utils.connect_fridge_user( username=self.user[2].username, fridge=self.fridge.name, role=const.Constants.ROLE_USER ) test_utils.create_login_token( timezone.now() + timezone.timedelta(days=1), username=self.user[0].username ) test_utils.create_api_token( timezone.now() + timezone.timedelta(days=1), tok="API Token User1", username=self.user[0].username ) test_utils.create_login_token( timezone.now() + timezone.timedelta(days=1), username=self.user[1].username ) test_utils.create_api_token( timezone.now() + timezone.timedelta(days=1), tok="API Token User2", username=self.user[1].username ) test_utils.create_login_token( timezone.now() + timezone.timedelta(days=1), username=self.user[2].username ) test_utils.create_api_token( timezone.now() + timezone.timedelta(days=1), tok="API Token User3", username=self.user[2].username ) return super().setUp()
def setUp(self): """Setup for test case""" self.factory = RequestFactory() test_utils.create_dummyuser() test_utils.create_dummyuser("Dummy2", "Not Dummy", "Is", "*****@*****.**")