Exemplo n.º 1
0
    def testClearUserData(self):
        user = users.User("*****@*****.**")
        first_name = "Master"
        second_name = "Roshi"
        ghost_name = "Babadook"

        ghost = Ghost(
            gmail=user,
            first_name=first_name,
            second_name=second_name,
            ghost_name=ghost_name)
        ghost.put()

        stored_ghost = Ghost.query().get()

        assert stored_ghost.gmail == user
        assert stored_ghost.first_name == first_name
        assert stored_ghost.second_name == second_name
        assert stored_ghost.ghost_name == ghost_name

        GhostrEngine.clear_user_data(stored_ghost)

        updated_stored_ghost = Ghost.query().get()

        assert updated_stored_ghost.gmail is None
        assert updated_stored_ghost.first_name is None
        assert updated_stored_ghost.second_name is None
Exemplo n.º 2
0
    def testGetFromUser(self):
        user = users.User("*****@*****.**")
        ghost = Ghost(gmail=user)

        ghost.put()

        assert GhostrEngine.get_from_user(user) == ghost
        assert GhostrEngine.get_from_user(None) is None
Exemplo n.º 3
0
    def testGhostProperties(self):
        user = users.User("*****@*****.**")
        first_name = "Master"
        second_name = "Roshi"
        ghost_name = "Babadook"

        ghost = Ghost(
            gmail=user,
            first_name=first_name,
            second_name=second_name,
            ghost_name=ghost_name)
        ghost.put()

        stored_ghost = Ghost.query().get()

        self.assertEqual(user, stored_ghost.gmail)
        self.assertEqual(first_name, stored_ghost.first_name)
        self.assertEqual(second_name, stored_ghost.second_name)
        self.assertEqual(ghost_name, stored_ghost.ghost_name)
Exemplo n.º 4
0
    def testGetFromGhostname(self):
        ghost = Ghost(ghost_name="Tom")
        ghost.put()

        assert GhostrEngine.get_from_ghostname("Tom") == ghost