Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vui current state rebased #2752

Merged
merged 45 commits into from
Jan 25, 2022
Merged

Conversation

davidraker
Copy link
Contributor

@davidraker davidraker commented Aug 18, 2021

Description

Draft PR for VOLTTRON User Interface (VUI) API. This is not fully covered with tests, and has some work remaining before it should be merged.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Partial coverage by unit tests for volttron.platform.web.vui_endpoints. Further tests required before merge.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@craig8 craig8 self-requested a review August 20, 2021 19:28
davidraker and others added 26 commits September 1, 2021 23:17
… will get removed eventually, and the work moved into a separate repository.
…y be working, but my driver is not... Still need tags, regex, PUT, and DELETE for devices.
…y be working, but my driver is not... Still need tags, regex, PUT, and DELETE for devices.
@craig8 craig8 self-assigned this Jan 22, 2022
@craig8 craig8 marked this pull request as ready for review January 22, 2022 00:11
Copy link
Contributor

@craig8 craig8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing treelib from the web requirements.py file.

Copy link
Contributor

@craig8 craig8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your tests you assume your platform historian has all of the things your platform does. Or at least that is what it seems to be saying.

___________________________________________ test_handle_platforms_historians_historian_topics_get_response[Campus/Building1/Fake1/SampleBool1-True-False-False-False] ___________________________________________

mock_platform_web_service = <volttron.platform.web.platform_web_service.PlatformWebService object at 0x7f5f6f494f70>, topic = 'Campus/Building1/Fake1/SampleBool1', is_full_topic = True, read_all = False
return_routes = False, return_values = False

    @pytest.mark.parametrize('topic, is_full_topic, read_all, return_routes, return_values', [
        ('', False, False, True, True),
        ('', False, True, True, True),
        ('Campus/Building1/Fake1', False, False, True, True),
        ('Campus/Building1/Fake1', False, True, True, True),
        ('Campus/Building1/Fake1/SampleBool1', True, False, True, True),
        ('Campus/Building1/Fake1/SampleBool1', True, False, False, False)
    ])
    def test_handle_platforms_historians_historian_topics_get_response(mock_platform_web_service, topic, is_full_topic,
                                                                       read_all, return_routes, return_values):
        query_string = f'read-all={read_all}&routes={return_routes}&values={return_values}'
        env = get_test_web_env(f'/vui/platforms/my_instance_name/historians/platform.historian/topics/{topic}',
                               query_string=query_string, method='GET')
        vui_endpoints = VUIEndpoints(mock_platform_web_service)
        vui_endpoints._rpc = _mock_historians_rpc
        response = vui_endpoints.handle_platforms_historians_historian_topics(env, {})
        if not read_all and not is_full_topic:
            seg_number = 0 if topic == '' else len(topic.split('/'))
            keys = [list_topic.split('/')[seg_number] for list_topic in HISTORIAN_TOPIC_LIST]
            _log.debug(f'KEYS IS: {keys}')
            check_route_options_return(response, list(set(keys)))
        else:
            body = json.loads(response.response[0])
            assert isinstance(body, dict)
            _log.debug('BODY IS:')
            _log.debug(body)
            for k, v in body.items():
>               keys = v.keys()
E               AttributeError: 'str' object has no attribute 'keys'

volttrontesting/platform/web/test_vui_endpoints.py:654: AttributeError

The above is one example of that.

@craig8 craig8 merged commit b759c2d into VOLTTRON:develop Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants