def test_create_usertoken_on_user_created_is_correct(self): create_sample_user(username="******") self.assertEqual(SignInServiceProvider.objects.first().name, "snommoc.org") token = UserToken.objects.first() self.assertEqual(token.username, "SocialSignalTest")
def setUp(self) -> None: self.delete_instances_of(User) testuser = create_sample_user(username="******") self.enabled_api_key = ApiKey.objects.create(user=testuser, enabled=True) self.disabled_api_key = ApiKey.objects.create(user=testuser, enabled=False) user_with_permission = create_sample_user( username="******", password="******", email="*****@*****.**", ) grant_read_snommoc_api(user_with_permission)
def create_test_api_key(testcase): ApiKey.objects.create( user=create_sample_user(username="******"), enabled=True, key=key, ) f( testcase, query={ api_contract.API_KEY: key, }, **kwargs )
def setUp(self) -> None: user_with_permission = create_sample_user(username="******") grant_read_snommoc_api(user_with_permission) self.client.force_login(user_with_permission)