Beispiel #1
0
    def test_non_str_input_returns_http_400(self) -> None:
        not_a_str = 123

        assertHttpResponse(
            self.lock(not_a_str, True),  # type: ignore
            400,
        )
Beispiel #2
0
    def test_non_bool_input_returns_http_400(self) -> None:
        not_a_bool = 123

        assertHttpResponse(
            self.devmode(not_a_bool),  # type: ignore
            400,
        )
Beispiel #3
0
    def test_nuke_procedure(self) -> None:
        # used "key" as it is randomized when creating a fresh session
        old_key = self.shimon.cache["key"]

        assertHttpResponse(ApiNuke().entry(self.shimon, self.pwd, False), code=200)

        assert self.shimon.cache["key"] != old_key
Beispiel #4
0
    def test_non_str_input_returns_http_400(self) -> None:
        not_a_string = 123

        assertHttpResponse(
            self.allfor(not_a_string),  # type: ignore
            400,
        )
Beispiel #5
0
    def test_non_str_input_returns_http_400(self) -> None:
        self.reset()
        not_a_str = 123

        assertHttpResponse(
            self.theme(not_a_str),  # type: ignore
            400,
        )
Beispiel #6
0
    def test_missing_password_with_policy_1_returns_http_401(self) -> None:
        old_policy = self.shimon.msg_policy
        self.shimon.cache.mapper["msg policy"] = 1

        assertHttpResponse(
            self.delete_msg(
                {"id": self.user["id"], "index": "0", "pwd": "not the password"}
            ),
            401,
        )

        self.shimon.cache.mapper["msg policy"] = old_policy
Beispiel #7
0
    def test_empty_msg_or_uname_returns_http_400(self) -> None:
        assertHttpResponse(
            ApiSendMsg().entry(self.shimon, {
                "uname": "whatever",
                "msg": None
            }, False),
            400,
        )

        assertHttpResponse(
            ApiSendMsg().entry(self.shimon, {
                "uname": None,
                "msg": "whatever"
            }, False),
            400,
        )
Beispiel #8
0
 def test_invalid_index_returns_http_400(self) -> None:
     assertHttpResponse(
         self.delete_msg({"id": self.user["id"], "index": "-1", "pwd": self.pwd}),
         400,
     )
Beispiel #9
0
 def test_always_returns_http_200(self) -> None:
     assertHttpResponse(self.friends(), 200)
Beispiel #10
0
    def test_oob_int_returns_http_400(self) -> None:
        assertHttpResponse(self.expiration("0"), 400)

        assertHttpResponse(self.expiration("9999999"), 400)
Beispiel #11
0
 def test_invalid_session_returns_http_401(self) -> None:
     assertHttpResponse(api_entry(self.shimon, {"not a call": ""}), 401)
Beispiel #12
0
 def test_blank_unlock_pwd_returns_http_400(self) -> None:
     assertHttpResponse(api_entry(self.shimon, {"unlock": ""}), 401)
Beispiel #13
0
    def test_non_str_input_returns_http_400(self) -> None:
        not_a_str = 123

        assertHttpResponse(ApiNuke().entry(self.shimon, not_a_str, False), code=400)
Beispiel #14
0
    def test_unlock_via_entry_works(self) -> None:
        # clear the cache as if we had locked and are re-opening
        self.shimon.cache.wipe()

        assertHttpResponse(api_entry(self.shimon, {"unlock": self.pwd}), 200)
Beispiel #15
0
 def test_invalid_pwd_returns_http_401(self) -> None:
     assertHttpResponse(self.unlock("not the pwd"), 401)
Beispiel #16
0
 def test_always_returns_http_200(self) -> None:
     assertHttpResponse(self.devmode(True), 200)
Beispiel #17
0
 def test_whitespace_only_msg_returns_http_400(self) -> None:
     assertHttpResponse(self.send_msg_wrapper("   "), 400)
Beispiel #18
0
 def run(self: TestNewKey) -> None:
     assertHttpResponse(self.new_key(self.pwd), 200)
Beispiel #19
0
 def test_invalid_password_returns_http_401(self) -> None:
     assertHttpResponse(self.new_key("not the password"), 401)
Beispiel #20
0
 def test_incorrect_pwd_returns_http_401(self) -> None:
     assertHttpResponse(
         ApiNuke().entry(self.shimon, "not the password", False), code=401
     )
Beispiel #21
0
 def test_missing_msg_param_returns_http_400(self) -> None:
     assertHttpResponse(
         ApiSendMsg().entry(self.shimon, {"uname": "user"}, False), 400)
Beispiel #22
0
 def test_valid_id_always_returns_http_200(self) -> None:
     user = self.shimon.cache["history"][0]
     assertHttpResponse(self.allfor(user["id"]), 200)
Beispiel #23
0
        def run(self: TestEntry) -> None:
            api_entry(self.shimon, {"unlock": self.pwd})

            assertHttpResponse(api_entry(self.shimon, {"unlock": self.pwd}),
                               301)
Beispiel #24
0
 def test_invalid_id_always_returns_http_400(self) -> None:
     assertHttpResponse(self.allfor("not a user id"), 400)
Beispiel #25
0
 def run(self: TestEntry) -> None:
     assertHttpResponse(api_entry(self.shimon, {"not a call": ""}), 400)
Beispiel #26
0
 def test_uname_not_in_friend_list_returns_http_400(self) -> None:
     assertHttpResponse(
         self.send_msg_wrapper("hello", uname="not a valid uname"), 400)
Beispiel #27
0
 def test_not_valid_int_returns_http_400(self) -> None:
     assertHttpResponse(self.expiration("not an int"), 400)
Beispiel #28
0
 def test_invalid_data_returns_http_400(self) -> None:
     assertHttpResponse(
         self.delete_msg(""),  # type: ignore
         400,
     )
Beispiel #29
0
 def test_valid_int_returns_http_202(self) -> None:
     assertHttpResponse(self.expiration(str(self.shimon.session.expires)),
                        202)
Beispiel #30
0
 def test_missing_index_param_returns_http_400(self) -> None:
     assertHttpResponse(self.delete_msg({"id": "test id"}), 400)