def test_is_over_quota(self):
        api_key = "SFUlqzam8"
        response = api_user.is_over_quota(api_key, self.d)
        assert_equals(response, False)

        api_user.add_registration_data(("doi", "10.a"), "tiida", api_key, self.d)
        api_user.add_registration_data(("doi", "10.b"), "tiidb", api_key, self.d)
        api_user.add_registration_data(("doi", "10.c"), "tiidc", api_key, self.d)
        response = api_user.is_over_quota(api_key, self.d)
        assert_equals(response, True)
    def test_is_over_quota(self):
        api_key = self.existing_api_user.api_key
        response = api_user.is_over_quota(api_key)
        assert_equals(response, False)

        for x in ["a", "b", "c"]:  # max_registered_items was set to 3 for this test api_user
            try:
                response = api_user.register_item(("doi", "10."+x), api_key, self.r, self.d)
                print response["registered_item"]
                self.db.session.add(response["registered_item"])
            except ApiLimitExceededException:
                pass

        self.db.session.commit()

        response = api_user.is_over_quota(api_key)
        assert_equals(response, True)
Example #3
0
    def test_is_over_quota(self):
        api_key = self.existing_api_user.api_key
        response = api_user.is_over_quota(api_key)
        assert_equals(response, False)

        for x in [
                "a", "b", "c"
        ]:  # max_registered_items was set to 3 for this test api_user
            try:
                response = api_user.register_item(("doi", "10." + x), api_key,
                                                  self.r, self.d)
                print response["registered_item"]
                self.db.session.add(response["registered_item"])
            except ApiLimitExceededException:
                pass

        self.db.session.commit()

        response = api_user.is_over_quota(api_key)
        assert_equals(response, True)