def test_with_alias(self): create_employee(username='******') create_alias_with_employee_username(name='buddyalias', username='******') response = self.app.get('/buddyalias') self.assertEqual(response.status_int, 302) self.assertIn('/explore?user=buddy', response.location)
def test_send_loves_with_alias_and_username_for_same_user(self): create_alias_with_employee_username(name='bobby', username=self.bob.username) with self.assertRaises(TaintedLove): logic.love.send_loves(['bob', 'bobby'], 'hallo', sender_username='******') loves_for_bob = logic.love.get_love('alice', 'bob').get_result() self.assertEqual(loves_for_bob, [])
def test_send_loves_with_alias(self): message = 'Loving your alias' create_alias_with_employee_username(name='bobby', username=self.bob.username) logic.love.send_loves(['bobby'], message, sender_username=self.carol.username) loves_for_bob = logic.love.get_love('carol', 'bob').get_result() self.assertEqual(len(loves_for_bob), 1) self.assertEqual(loves_for_bob[0].sender_key, self.carol.key) self.assertEqual(loves_for_bob[0].message, message)
def test_deleting_alias(self, mock_logic_alias): create_employee(username='******') csrf_token = self.addCsrfTokenToSession() alias = create_alias_with_employee_username(name='mano', username='******') response = self.app.post( '/aliases/{id}/delete'.format(id=alias.key.id()), {'_csrf_token': csrf_token}, ) self.assertEqual(response.status_int, 302) mock_logic_alias.delete_alias.assert_called_once_with(alias.key.id())
def test_get_alias(self): create_employee(username='******') create_alias_with_employee_username(name='fuzzi', username='******') self.assertIsNotNone(logic.alias.get_alias('fuzzi'))
def setUp(self): self.api_key = AccessKey.create('test key').access_key create_employee(username='******') create_alias_with_employee_username(name='bobby', username='******') create_employee(username='******')