예제 #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
예제 #2
0
    def testSetup(self):
        test_names = ["Tom", "Dick", "Harry"]
        GhostrEngine.setup(test_names)

        stored_ghosts = Ghost.query()

        for ghost in stored_ghosts:
            assert ghost.ghost_name in test_names
예제 #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)
예제 #4
0
 def testInsertEntity(self):
     Ghost().put()
     self.assertEqual(1, len(Ghost.query().fetch(2)))