Example #1
0
    def test_fetch_over_provisioned(self):
        s = get_storage_table()
        storage = Storage(s, SinkMetrics())
        storage.table.connection = Mock()

        def raise_error(*args, **kwargs):
            raise ProvisionedThroughputExceededException(None, None)

        storage.table.connection.put_item.side_effect = raise_error
        with self.assertRaises(ProvisionedThroughputExceededException):
            storage.save_notification("asdf", "asdf", 12)
Example #2
0
    def test_fetch_over_provisioned(self):
        s = get_storage_table()
        storage = Storage(s, SinkMetrics())
        storage.table.connection = Mock()

        def raise_error(*args, **kwargs):
            raise ProvisionedThroughputExceededException(None, None)

        storage.table.connection.put_item.side_effect = raise_error
        with self.assertRaises(ProvisionedThroughputExceededException):
            storage.save_notification(dummy_uaid, dummy_chid, 12)
Example #3
0
    def test_fetch_boto_err(self):
        s = get_storage_table()
        storage = Storage(s, SinkMetrics())
        storage.table.connection = Mock()

        def raise_error(*args, **kwargs):
            raise BotoServerError(None, None)

        storage.table.connection.put_item.side_effect = raise_error
        with assert_raises(BotoServerError):
            storage.save_notification(dummy_uaid, dummy_chid, 12)
Example #4
0
    def test_dont_save_older(self):
        s = get_storage_table()
        storage = Storage(s, SinkMetrics())
        # Unfortunately moto can't run condition expressions, so
        # we gotta fake it
        storage.table.connection = Mock()

        def raise_error(*args, **kwargs):
            raise ConditionalCheckFailedException(None, None)

        storage.table.connection.put_item.side_effect = raise_error
        result = storage.save_notification("fdas", "asdf", 8)
        eq_(result, False)
Example #5
0
    def test_dont_save_older(self):
        s = get_storage_table()
        storage = Storage(s, SinkMetrics())
        # Unfortunately moto can't run condition expressions, so
        # we gotta fake it
        storage.table.connection = Mock()

        def raise_error(*args, **kwargs):
            raise ConditionalCheckFailedException(None, None)

        storage.table.connection.put_item.side_effect = raise_error
        result = storage.save_notification(dummy_uaid, dummy_chid, 8)
        eq_(result, False)