def test_current_utc_time():
    #setup
    #Excercise
    result = meteogram.current_utc_time()

    # verify
    truth = datetime.datetime.utcnow()
    assert result.replace(microsecond=0) == truth.replace(microsecond=0)
Exemple #2
0
def test_current_utc_time():
    # Setup - none
    # Exercise
    result = meteogram.current_utc_time()

    # Verify
    truth = datetime.utcnow()
    assert_almost_equal(result.timestamp(), truth.timestamp(), 4)  # smoke test
def test_mock_current_utc_time():
    """
    Test if can know to use mock
    """

    result = meteogram.current_utc_time()

    expected = datetime(2011, 11, 11, 11)

    assert result == expected
def test_that_mock_works():
    """
    Test if we really know how to use a mock
    """

    # Setup - None
    # Excercise
    result = meteogram.current_utc_time()
    # Verify
    truth = datetime.datetime(2018, 3, 26, 12)
    assert result == truth
def test_mocked_current_utc_time() -> None:
    """Test if we really got the mock set up correctly
    """
    # Setup - None

    # Exercise
    results = meteogram.current_utc_time()

    # Verify
    desired = datetime(2018, 3, 26, 12)
    assert results == desired
def test_that_mock_works():
    """
    First, obviously, test that mock is being used correctly
    especially important for more complicated mocks!
    """
    # Setup - none

    # Exercise
    result = meteogram.current_utc_time()

    # Verify
    truth = meteogram.datetime.datetime(2018, 3, 26, 12)
    assert (result == truth)
def test_current_utc_time() -> None:
    """Ensure that the UTC time returned is valid and is larger than the
    UTC time at time of writing this test
    """
    # Setup - None

    # Exercise
    result = meteogram.current_utc_time()

    # Verify
    desired = datetime.utcnow()
    delta = desired - result
    assert delta.microseconds < 1000
def test_current_utc_time():
    """
    Call it twice and ignore the microseconds part
    """
    # Setup - none

    # Exercise
    result = meteogram.current_utc_time()

    # Verify
    truth = meteogram.datetime.datetime.utcnow()
    delta = truth.timestamp() - result.timestamp()
    # test that less than 1/10000th of a second occurs between calls
    assert_almost_equal(delta, 0, 4)